package com.demo.controller;

import com.demo.common.model.R;
import com.demo.service.CustomerService;
import com.demo.vo.CustomerVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/customer")
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    /**
     * 查询客户列表
     */
    @GetMapping("/page")
    public R<PageInfo<CustomerVo>> loadCustomerPage(@RequestParam Integer current,
                                                    @RequestParam(required = false,defaultValue = "10")Integer pageSize){
        PageInfo<CustomerVo> pageInfo = customerService.queryCustomerListByPage(current,pageSize);
        return R.OK(pageInfo);
    }
}
